-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix typing errors and set up mypy
workflow action
#176
Conversation
Codecov Report
@@ Coverage Diff @@
## main #176 +/- ##
==========================================
+ Coverage 94.07% 94.15% +0.07%
==========================================
Files 49 49
Lines 3241 3267 +26
==========================================
+ Hits 3049 3076 +27
+ Misses 192 191 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
13680fb
to
7cbea48
Compare
scico/linop/optics.py
Outdated
@@ -59,13 +59,15 @@ def radial_transverse_frequency( | |||
raise ValueError("Invalid input dimensions; must be 1 or 2") | |||
|
|||
if np.isscalar(dx): | |||
dx = (dx,) * ndim | |||
dx = (dx,) * ndim # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly this could be achieved via a type guarding version of isscalar
https://mypy.readthedocs.io/en/latest/type_narrowing.html#user-defined-type-guards
Remaining issues to be dealt with notes as #284. |
Fix typing errors and set up
mypy
workflow actionTo check a single file:
The typing tests are now passing, with some significant limitations, as reflected in the command
Most significantly, this excludes testing of
scico.numpy
, which results in 100s of typing errors, primarily due to unrecognized functions (which are dynamically constructed) in that module. Despite these limitations, I propose that we merge this PR now so that future changes are subjected to at least some typing testing. Follow-on projects would be:# type: ignore
to determine whether the error that led to its insertion can instead be resolved by improved type annotation or use of type guards.prox
method).